<?php

namespace app\validate;

use think\Validate;

class PostRecord extends Validate
{
    // 验证规则
    protected $rule = [];

    // create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data', 'require')
            ->append('data.post_id', 'require')
            ->append('data.chat_name', 'require|max:255');
    }

    // update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data', 'require')
            ->append('data.operation', 'require')
            ->append('data.id', 'require');
    }

    // select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.page', 'require')
            ->append('param.filter.recently', 'require');
    }

    // find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.post_id', 'require');
    }

    // delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param', 'require')
            ->append('param.filter.id', 'require');
    }
}
